home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import re
- from checkbox.properties import Path
- from checkbox.plugin import Plugin
-
- class DiskInfo(Plugin):
- filename = Path(default = '/var/log/installer/casper.log')
-
- def register(self, manager):
- super(DiskInfo, self).register(manager)
- self._manager.reactor.call_on('report', self.report)
-
-
- def report(self):
-
- try:
- file = open(self.filename)
- except IOError:
- return None
-
- distributor_regex = '(?P<distributor>[\\w\\-]+)'
- release_regex = '(?P<release>[\\d\\.]+)'
- codename_regex = '(?P<codename>[^_]+)'
- official_regex = '(?P<official>[\\w ]+)'
- architecture_regex = '(?P<architecture>[\\w\\+]+)'
- type_regex = '(?P<type>Binary-\\d+)'
- date_regex = '(?P<date>[^\\)]+)'
- info_regex = '%s %s _%s_ - %s %s (%s )?\\(%s\\)' % (distributor_regex, release_regex, codename_regex, official_regex, architecture_regex, type_regex, date_regex)
- line_regex = "Found label '%s'" % info_regex
- line_pattern = re.compile(line_regex)
- for line in file.readlines():
- match = line_pattern.match(line)
- if match:
- keys = [
- 'distributor',
- 'release',
- 'codename',
- 'official',
- 'architecture',
- 'date']
- values = [ match.group(k) for k in keys ]
- message = dict(zip(keys, values))
- self._manager.reactor.fire('report-disk', message)
- break
- continue
- []
-
-
-
- factory = DiskInfo
-